import "reflect-metadata/lite"
import { InversifyExpressServer } from 'inversify-express-utils'
import { Container } from 'inversify'
import express from 'express'

import { User } from './src/user/controller'
import { UserService } from './src/user/services'

// 创建容器
const container = new Container()

// 绑定服务
container.bind<User>(User).to(User)
container.bind<UserService>(UserService).to(UserService)

// 创建服务
const server = new InversifyExpressServer(container)
server.setConfig(app => {
  app.use(express.json())
})
// 启动
const app = server.build()

app.listen(3030, () => {
  console.log('启动')
})